package com.ruoyi.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.mapper.BasisTypicalObjectivesMapper;
import com.ruoyi.domain.BasisTypicalObjectives;
import com.ruoyi.service.IBasisTypicalObjectivesService;

/**
 * 典型目标管理Service业务层处理
 * 
 * @author wangzebing
 * @date 2025-03-27
 */
@Service
public class BasisTypicalObjectivesServiceImpl implements IBasisTypicalObjectivesService 
{
    @Autowired
    private BasisTypicalObjectivesMapper basisTypicalObjectivesMapper;

    /**
     * 查询典型目标管理
     * 
     * @param id 典型目标管理主键
     * @return 典型目标管理
     */
    @Override
    public BasisTypicalObjectives selectBasisTypicalObjectivesById(Long id)
    {
        return basisTypicalObjectivesMapper.selectBasisTypicalObjectivesById(id);
    }

    /**
     * 查询典型目标管理列表
     * 
     * @param basisTypicalObjectives 典型目标管理
     * @return 典型目标管理
     */
    @Override
    public List<BasisTypicalObjectives> selectBasisTypicalObjectivesList(BasisTypicalObjectives basisTypicalObjectives)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisTypicalObjectives.setUserId(user.getUserId());
        return basisTypicalObjectivesMapper.selectBasisTypicalObjectivesList(basisTypicalObjectives);
    }

    /**
     * 新增典型目标管理
     * 
     * @param basisTypicalObjectives 典型目标管理
     * @return 结果
     */
    @Override
    public int insertBasisTypicalObjectives(BasisTypicalObjectives basisTypicalObjectives)
    {
        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisTypicalObjectives.setUserId(user.getUserId());
        basisTypicalObjectives.setCreateTime(new Date());
        return basisTypicalObjectivesMapper.insertBasisTypicalObjectives(basisTypicalObjectives);
    }

    /**
     * 修改典型目标管理
     * 
     * @param basisTypicalObjectives 典型目标管理
     * @return 结果
     */
    @Override
    public int updateBasisTypicalObjectives(BasisTypicalObjectives basisTypicalObjectives)
    {
        return basisTypicalObjectivesMapper.updateBasisTypicalObjectives(basisTypicalObjectives);
    }

    /**
     * 批量删除典型目标管理
     * 
     * @param ids 需要删除的典型目标管理主键
     * @return 结果
     */
    @Override
    public int deleteBasisTypicalObjectivesByIds(Long[] ids)
    {
        return basisTypicalObjectivesMapper.deleteBasisTypicalObjectivesByIds(ids);
    }

    /**
     * 删除典型目标管理信息
     * 
     * @param id 典型目标管理主键
     * @return 结果
     */
    @Override
    public int deleteBasisTypicalObjectivesById(Long id)
    {
        return basisTypicalObjectivesMapper.deleteBasisTypicalObjectivesById(id);
    }

    @Override
    public List<BasisTypicalObjectives> findAllBasisTypicalObjectives(BasisTypicalObjectives basisTypicalObjectives) {

        SysUser user = SecurityUtils.getLoginUser().getUser();
        basisTypicalObjectives.setUserId(user.getUserId());
        return basisTypicalObjectivesMapper.findAllBasisTypicalObjectives(basisTypicalObjectives);
    }
}
